#include "guiterm.hpp"
#include <unistd.h>

TempFileManager *TempFileManager::instance()
{
	static TempFileManager *inst = NULL;
	if(!inst) inst = new TempFileManager();
	return inst;
}

string TempFileManager::getTempFile(string basename)
{
	return tempDir+"/"+basename;
}

void TempFileManager::deleteTempFiles()
{
	for(size_t ii=0; ii<tempFiles.size(); ii++)
		unlink(tempFiles[ii].c_str());
	tempFiles.clear();
}

TempFileManager::TempFileManager()
{
	char *envTempDir = getenv("TEMP");
	if(envTempDir)
		tempDir = envTempDir;
	else
		tempDir = "/tmp";
}


